//
//  Tire.m
//  Chapt10_CarPartsInit_v10-01
//
//  Created by Ronald Ram on 13/02/2011.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "Tire.h"


@implementation Tire

//==================START: INITILIZER METHODS ==================

//Designated Initializer!!
-(id) initWithPressure:(float)p threadDepth:(float)td
{
    self = [super init];
    
    if ( self )
    {
        pressure = p;  threadDepth = td;
    }
    
    return (self);
}

//Initializer Method
-(id) initWithPressure:(float)p
{
    self = [self initWithPressure:p threadDepth:20];
    return (self);
}

//Initializer Method
-(id) initWithThreadDepth:(float)td
{
    self = [self initWithPressure:34 threadDepth:td];
    return (self);
}

//Initializer Method
-(id) init
{
    self = [self initWithPressure:34 threadDepth:20];
    return (self);
}

//==================END: INITILIZER METHODS ==================



//M001: Set Pressure
-(void) setPressure : (float)p
{
    pressure = p;
}

//M002: Get Pressure
-(float) pressure
{
    return (pressure);
}

//M003: Set threadPressure
-(void) setThreadDepth : (float)td
{
    threadDepth = td;
}

//M004: Get threadDepth
-(float) threadDepth
{
    return (threadDepth);
}

-(NSString *) description
{
    NSString *desc;
    desc = [ NSString stringWithFormat: 
            @"Tire: pressure: %.1f threadDepth: %.1f", pressure, threadDepth ];
    
    return (desc);
}

@end
